<template>
  <div id="warehouseRv">
    <!-- 查询条件 -->
    <el-form :inline="true" class="demo-form-inline">
      <el-form-item label="仓库名">
        <el-input placeholder="请输入仓库名"></el-input>
      </el-form-item>
      <el-form-item label="仓库类型">
        <el-select placeholder="请选择类型">
          <el-option label="普通仓库" value="普通仓库"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="审核进度">
        <el-select placeholder="全部">
          <el-option label="全部" value=""></el-option>
          <el-option label="等待审核" value="S001-1"></el-option>
          <el-option label="已审核" value="S001-2"></el-option>
          <el-option label="未审核" value="S001-3"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search">查询</el-button>
        <el-button icon="el-icon-refresh-right">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 表格 -->
    <el-table :data="tableData"  style="width: 100%;">
      <el-table-column prop="id" label="编号" width="80" align="center"></el-table-column>
      <el-table-column prop="name" label="仓库名称" width="180" align="center"></el-table-column>
      <el-table-column prop="type" label="仓库类型" width="120" align="center"></el-table-column>
      <el-table-column prop="registrar" label="登记人" width="120" align="center"></el-table-column>
      <el-table-column prop="time" label="登记时间" width="200" align="center"></el-table-column>
      <el-table-column prop="operation" label="申请操作" width="120" align="center"></el-table-column>
      <el-table-column prop="status" label="审核状态" width="120" align="center">
        <template slot-scope="scope">
          <span :class="{ 'text-success': scope.row.status === '通过审核', 'text-danger': scope.row.status === '驳回申请' }">{{ scope.row.status }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)" icon="el-icon-edit">审核</el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="currentPage"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        style="margin-top: 20px; text-align: right;"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  name: "WarehouseRv",
  data() {
    return {
      tableData: [],
      currentPage: 1,
      pageSize: 7,
      total: 0
    };
  },
  methods: {
    //初始化表格数据
    initTable() {

    },
    handleEdit(index, row) {
      console.log('编辑:', index, row);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    }
  },
  mounted() {
    this.initTable();
  }
};
</script>

<style scoped>
.demo-form-inline {
  margin-bottom: 20px;
}
.el-table {
  margin-top: 20px;
}
.el-pagination {
  margin-top: 20px;
  text-align: right;
}

.text-success {
  color: green;
}

.text-danger {
  color: red;
}

/* 新增：使表格内容居中 */
.el-table .cell {
  text-align: center;
}
.el-table >>> .el-table__header tr th {
  background-color: lightgray;
  color: black;
}
</style>
